﻿@namespace Project.Web.Shared.Components
@using System.Linq.Expressions
@using Project.Constraints.Page
@inherits AppComponentBase
<CascadingValue Value="this">
	@if (StackLayout || Header is not null)
	{
		<div @attributes="@AdditionalParameters" style="margin-bottom:@Gap.ToPixel()">
			@if (Header is not null)
			{
				<StackPanel Gap="@Gap">
					@Header
					@UI.BuildButton(this).OnClick(() => expand = !expand).Text(expand ? "收起" : "展开").Render()
				</StackPanel>
				<div style="margin-top:@Gap.ToPixel(); display:@(expand ? "block":"none");">
					<StackPanel Gap="@Gap" Wrap>
						@ChildContent
					</StackPanel>
				</div>
			}
			else
			{
				<StackPanel Gap="@Gap">
					@ChildContent
				</StackPanel>
			}
		</div>
	}
	else
	{
		<div @attributes="@AdditionalParameters" style="margin-bottom:@Gap.ToPixel()">
			<MGrid MinWidth=@ColumnWidth GridColumns="@Column" Gap="@Gap.ToPixel()">
				@ChildContent
			</MGrid>
		</div>
	}
</CascadingValue>
